#include <iostream>
using namespace std;
string intToRoman(int num)
{
    int values[13] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
    string strs[13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
    string res;
    for (int i = 0; i < 13; i++)
    {
        while (num >= values[i])
        {
            res += strs[i];
            num -= values[i];
        }
    }
    return res;
}
int main()
{
    cout << intToRoman(3999) << endl;
    cout << intToRoman(19) << endl;
    return 0;
}